<template name="AdminLayout">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{#if AdminConfig}}
 {{#if isInRole 'admin'}}
	<div class="admin-layout">
		<div class="skin-{{adminGetSkin}}">
			{{> AdminHeader}}
			<div class="wrapper row-offcanvas row-offcanvas-left">
				{{> AdminSidebar }}
				<aside class="right-side">
					<section class="content-header">
						<h1>
							{{$.Session.get 'admin_title'}}
							<small>{{$.Session.get 'admin_subtitle'}}</small>
						</h1>
						<div class="header-right">
							<ol class="breadcrumb">
								<li><a href="/admin/">{{_ "Dashboard"}}</a></li>
								{{#if $.Session.get 'admin_collection'}}
								<li><a href="/admin/{{admin_collection}}/">{{adminCollectionLabel admin_collection_name}}</a></li>
								{{/if}}
								
								{{#if $.Session.equals 'admin_collection_page' 'new'}}
								<li><a href="/admin/{{admin_collection}}/new">{{_ "New"}}</a></li>
								{{/if}}

								{{#if $.Session.equals 'admin_collection_page' 'edit'}}
								<li><a href="/admin/{{admin_collection}}/edit">{{_ "Edit"}}</a></li>
								{{/if}}

								
							</ol>
							{{#if $.Session.get 'admin_collection_name'}}
							<a href="{{pathFor 'adminDashboardNew' collection=admin_collection_name}}" class="new-document"><i class="fa fa-plus"></i></a>
							{{/if}}
						</div>
					</section>
					<section class="content">
						{{> yield }}
					</section>
				</aside>

			</div>
		</div>
	</div>
	{{> AdminDeleteModal }}
	{{else}}
	{{> NotAdmin}}
	{{/if}}
	{{else}}
	{{> NoConfig}}
	{{/if}}
</template>

<template name="AdminDeleteModal">
	<div class="modal fade" id="admin-delete-modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title">{{_ "Confirm delete"}}</h4>
				</div>
				<div class="modal-body">
					<p>Are you sure you want to delete this?</p>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
					<button type="button" id="confirm-delete" class="btn btn-danger">Delete</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->
	</div><!-- /.modal -->
</template>

<template name="NotAdmin">
<div class="container">
<div class="row">
	<div class="col-md-4 col-md-offset-4">
		<p class="alert alert-info" style="margin-top:100px;">
			{{_ "You need to be an admin to view this page"}}
		</p>
	</div>
</div>
</div>
</template>

<template name="NoConfig">
	<p class="alert alert-info">
		{{_ "You need to define an AdminConfig object to use the admin dashboard."}}
		<br/>
		{{_ "A basic config to manage the 'Posts' and 'Comments' collection would look like this:"}}
		<br/>
		<code>
		AdminConfig = {
		<br/>
			adminEmails: ['	ben@code2create.com'],
		<br/>
			collections: 
		<br/>
				{
		<br/>
					Posts: {},
		<br/>
					Comments: {}
		<br/>
				}
		<br/>
		}
		</code>
	</p>
</template>
